package com.example.module_repair.repairnet

import com.example.module_repair.repair_orders.model.CraeateRepairOrderModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

class RepairRePo @Inject constructor() {
    @Inject
    @RepairNetMoudle.CommonRepaireApi
    lateinit var repairApi: RepairApi

    //获取报修单
    fun getRepairOrders() =
        flow {
            emit(repairApi.getRepairOrders())
        }.flowOn(Dispatchers.IO)

    //创建报修单
    fun createRepairOrders(createrepairoremodel: CraeateRepairOrderModel) = flow {
        emit(repairApi.createRepairOrders(createrepairoremodel))
    }.flowOn(Dispatchers.IO)
}